package pl.un4giv3n.mightvsmagic.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
@NamedQuery(name="find.template.skills", query="select s from SpecialSkill s where s.templateId = :templateId")
@Entity
public class SpecialSkill implements Comparable<SpecialSkill>{

	private Long id;
	private String name;
	private double dmgFactor;
	private double defFactor;
	private double speedFactor;
	private int minDmgIncrease;
	private int maxDmgIncrease;
	private int minDefIncrease;
	private int maxDefIncrease;
	private int iceDamage;
	private int fireDamage;
	private int earthDamage;
	private int windDamage;
	private int iceDefence;
	private int fireDefence;
	private int earthDefence;
	private int windDefence;
	/**
	 * item modificatiors
	 */
	private long strenghtModifier;
	private long staminaModifier;
	private long manaModifier;
	private long attackModifier;
	private long parryModifier;
	private long speedModifier;

	private long price;
	private long[] requiresToLearn;
	private long[] blocksLearning;
	private Long templateId;

	public SpecialSkill() {
	}

	public SpecialSkill(String name, double dmgFactor, double defFactor, double speedFactor,
			int minDmgIncrease, int maxDmgIncrease, int minDefIncrease,
			int maxDefIncrease, long strenghtModifier, long staminaModifier,
			long manaModifier, long attackModifier, long parryModifier,
			long speedModifier,
			long price, int iceDamage, int fireDamage, int earthDamage,
			int windDamage, int iceDefence, int fireDefence, int earthDefence,
			int windDefence, Long templateId, long[] requiresToLearn, long[] blocksLearning) {
		super();
		this.name = name;
		this.dmgFactor = dmgFactor;
		this.defFactor = defFactor;
		this.speedFactor = speedFactor;
		this.minDmgIncrease = minDmgIncrease;
		this.maxDmgIncrease = maxDmgIncrease;
		this.minDefIncrease = minDefIncrease;
		this.maxDefIncrease = maxDefIncrease;
		this.strenghtModifier = strenghtModifier;
		this.staminaModifier = staminaModifier;
		this.manaModifier = manaModifier;
		this.attackModifier = attackModifier;
		this.parryModifier = parryModifier;
		this.speedModifier = speedModifier;
		this.iceDamage = iceDamage;
		this.fireDamage = fireDamage;
		this.earthDamage = earthDamage;
		this.windDamage = windDamage;
		this.iceDefence = iceDefence;
		this.fireDefence = fireDefence;
		this.earthDefence = earthDefence;
		this.windDefence = windDefence;
		this.price = price;
		this.templateId = templateId;
		this.requiresToLearn = requiresToLearn;
		this.blocksLearning = blocksLearning;
	}

	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}

	void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return dmg factor, this should be treated as percentage, so needs to be divided by 100 for calculations
	 */
	public double getDmgFactor() {
		return dmgFactor;
	}

	public void setDmgFactor(double dmgFactor) {
		this.dmgFactor = dmgFactor;
	}

	/**
	 * @return def factor, this should be treated as percentage, so needs to be divided by 100 for calculations
	 */
	public double getDefFactor() {
		return defFactor;
	}

	public void setDefFactor(double defFactor) {
		this.defFactor = defFactor;
	}

	public int getMinDmgIncrease() {
		return minDmgIncrease;
	}

	public void setMinDmgIncrease(int minDmgIncrease) {
		this.minDmgIncrease = minDmgIncrease;
	}

	public int getMaxDmgIncrease() {
		return maxDmgIncrease;
	}

	public void setMaxDmgIncrease(int maxDmgIncrease) {
		this.maxDmgIncrease = maxDmgIncrease;
	}

	public int getMinDefIncrease() {
		return minDefIncrease;
	}

	public void setMinDefIncrease(int minDefIncrease) {
		this.minDefIncrease = minDefIncrease;
	}

	public int getMaxDefIncrease() {
		return maxDefIncrease;
	}

	public void setMaxDefIncrease(int maxDefIncrease) {
		this.maxDefIncrease = maxDefIncrease;
	}

	public long getStrenghtModifier() {
		return strenghtModifier;
	}

	public void setStrenghtModifier(long strenghtModifier) {
		this.strenghtModifier = strenghtModifier;
	}

	public long getStaminaModifier() {
		return staminaModifier;
	}

	public void setStaminaModifier(long staminaModifier) {
		this.staminaModifier = staminaModifier;
	}

	public long getManaModifier() {
		return manaModifier;
	}

	public void setManaModifier(long manaModifier) {
		this.manaModifier = manaModifier;
	}

	public long getAttackModifier() {
		return attackModifier;
	}

	public void setAttackModifier(long attackModifier) {
		this.attackModifier = attackModifier;
	}

	public long getParryModifier() {
		return parryModifier;
	}

	public void setParryModifier(long parryModifier) {
		this.parryModifier = parryModifier;
	}

	public long getPrice() {
		return price;
	}

	public void setPrice(long price) {
		this.price = price;
	}

	public int getIceDamage() {
		return iceDamage;
	}

	public void setIceDamage(int iceDamage) {
		this.iceDamage = iceDamage;
	}

	public int getFireDamage() {
		return fireDamage;
	}

	public void setFireDamage(int fireDamage) {
		this.fireDamage = fireDamage;
	}

	public int getEarthDamage() {
		return earthDamage;
	}

	public void setEarthDamage(int earthDamage) {
		this.earthDamage = earthDamage;
	}

	public int getWindDamage() {
		return windDamage;
	}

	public void setWindDamage(int windDamage) {
		this.windDamage = windDamage;
	}

	public int getIceDefence() {
		return iceDefence;
	}

	public void setIceDefence(int iceDefence) {
		this.iceDefence = iceDefence;
	}

	public int getFireDefence() {
		return fireDefence;
	}

	public void setFireDefence(int fireDefence) {
		this.fireDefence = fireDefence;
	}

	public int getEarthDefence() {
		return earthDefence;
	}

	public void setEarthDefence(int earthDefence) {
		this.earthDefence = earthDefence;
	}

	public int getWindDefence() {
		return windDefence;
	}

	public void setWindDefence(int windDefence) {
		this.windDefence = windDefence;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getTemplateId() {
		return templateId;
	}

	void setTemplateId(Long templateId) {
		this.templateId = templateId;
	}

	public long[] getRequiresToLearn() {
		return requiresToLearn;
	}

	public void setRequiresToLearn(long[] requiresToLearn) {
		this.requiresToLearn = requiresToLearn;
	}

	public long[] getBlocksLearning() {
		return blocksLearning;
	}

	public void setBlocksLearning(long[] blocksLearning) {
		this.blocksLearning = blocksLearning;
	}

	@Override
	public int compareTo(SpecialSkill o) {
		long thisVal = this.id;
		long anotherVal = o.id;
		return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
	}

	public long getSpeedModifier() {
		return speedModifier;
	}

	public void setSpeedModifier(long speedModifier) {
		this.speedModifier = speedModifier;
	}

	public double getSpeedFactor() {
		return speedFactor;
	}

	public void setSpeedFactor(double speedFactor) {
		this.speedFactor = speedFactor;
	}
	
	@Override
	public String toString() {
		return "Id="+id+", name="+name+", templateId="+templateId;
	}

}
